package cn.edu.cqvie.netty.handler.server;

import cn.edu.cqvie.netty.handler.codec.MyByteToLongDecoder2;
import cn.edu.cqvie.netty.handler.codec.MyLongToByteEncoder;
import cn.edu.cqvie.netty.handler.codec.MyLongToStringDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyServerInitalizer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {

        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast(new MyByteToLongDecoder2());
        pipeline.addLast(new MyLongToStringDecoder());

        pipeline.addLast(new MyLongToByteEncoder());

        pipeline.addLast(new MyServerHandler());
    }
}
